﻿using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace WpfApp2
{
    /// <summary>
    /// MainWindow.xaml 的交互逻辑
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
            List< Model> models = new List< Model>();   
            for (int i = 0; i < 10000; i++) {
                var model = new Model();
                model.Id = i+1;
                model.Name = "Name" + i;
                model.Col1 = DateTime.Now;
                model.Col2=new Random().NextDouble();
                models.Add(model);
            }
            grid.ItemsSource = models;
            //SqlConnection
        }

        private void Export_Click(object sender, RoutedEventArgs e)
        {
            string value = (grid.Columns[1].GetCellContent(grid.Items[1]) as TextBlock).Text;
            foreach (var item in grid.Items)
            {

            }
            ExcelHelper.Export(grid);
        }
    }

    public class Model
    {
        public int Id { get; set; }
        public string Name { get; set; }
        public DateTime Col1 { get; set; }
        public double Col2 { get; set; }
        public string Col3 { get; set; }
    }
}
